When will [MFMailComposeViewController canSendMail] return NO

Posted by pythonquick on Stack Overflow See other posts from Stack Overflow or by pythonquick
Published on 2010-03-19T22:49:43Z Indexed on 2010/03/19 22:51 UTC
Read the original article Hit count: 160

Filed under:
|
|

M iPhone app is using the MFMailComposeViewController class to send an in-app email with an attachment. The app will only attempt to display the mail composer dialog if the "canSendMail" method of class MFMailComposeViewController returns true (YES). Specifically, if the following method returns YES, it shows the mail composer, otherwise the user is presented with an error alert dialog stating that there are no email accounts set up on the device:

- (BOOL)canDeviceSendEmail
{
    Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
    return mailClass != nil && [mailClass canSendMail];
}

A team of testers have reported that they get this error alert dialog, even when email accounts are set up on the device. The tester used an iPhone 3G with OS 3.1.3. Therefore the MFMailComposeViewController class must have existed, and the "canSendMail" method must have returned NO.

My question is therefore: apart from the case when there are no email accounts set up on the device, in what other circumstances can the "canSendMail" method return NO?

~ Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk